@echo off 
setlocal

if NOT DEFINED cmake_bin (
    set cmake_bin="D:\software\msvc\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe"
)


set build_type=%1

if "%build_type%" == "" (
    set build_type=Release
)


call setup.bat %build_type%

echo "start building."

set script_dir=%~dp0
set build_dir=%script_dir%deploy
rd /S /Q %build_dir%
if not exist %build_dir% md %build_dir%

if NOT DEFINED DTK_SDK_DIR (
    set DTK_SDK_DIR=D:\software\datakit\DatakitLibsAndSampleProject_Dtk_Win_NET2022_x64_V2025.2
)

call %cmake_bin% -DCMAKE_BUILD_TYPE:STRING=%build_type%  -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DServer=on --no-warn-unused-cli -S%script_dir% -B%build_dir%
call %cmake_bin%  --build %build_dir% --config %build_type%  -j20 

call %cmake_bin% --install %build_dir%  --strip --config %build_type%


endlocal